<?php
namespace BWL\webshopBundle\DataFixtures\ORM;
/**
 * Created by JetBrains PhpStorm.
 * User: leon
 * Date: 11/20/12
 * Time: 7:44 PM
 * To change this template use File | Settings | File Templates.
 */


use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use BWL\webshopBundle\Entity\OrderState;

class OrderStateFixtures extends AbstractFixture implements OrderedFixtureInterface
{
  public function load(ObjectManager $manager) {
    $open = new OrderState();
    $open->setName('open');
    $open->setDescription('Bestellung wurde noch nicht bearbeited');
    $manager->persist($open);

    $inProgress = new OrderState();
    $inProgress->setName('inProcess');
    $inProgress->setDescription('Bestellung ist in bearbeitung');
    $manager->persist($inProgress);

    $waitForPayment = new OrderState();
    $waitForPayment->setName('waitForPayment');
    $waitForPayment->setDescription('Wir warten auf Ihre Zahlung');
    $manager->persist($waitForPayment);

    $shipped = new OrderState();
    $shipped->setName('shipped');
    $shipped->setDescription('Bestellung wurde versendet');
    $manager->persist($shipped);

    $closed = new OrderState();
    $closed->setName('closed');
    $closed->setDescription('Bestellung ist abgeschlossen');
    $manager->persist($closed);

    $manager->flush();


    // Save references
    $this->addReference('open', $open);
    $this->addReference('inProgress', $inProgress);
    $this->addReference('waitForPayment', $waitForPayment);
    $this->addReference('shipped', $shipped);
    $this->addReference('closed', $closed);
  }



  public function getOrder() {
    return 3;
  }
}
